package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.ArchiveReceiveStatistics;
import com.ruoyi.system.mapper.ArchiveReceiveStatisticsMapper;
import com.ruoyi.system.service.ArchiveReceiveStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 档案接收统计Service实现类
 *
 * @author [你的名字]
 */
@Service
public class ArchiveReceiveStatisticsServiceImpl implements ArchiveReceiveStatisticsService {
    @Autowired
    private ArchiveReceiveStatisticsMapper archiveReceiveStatisticsMapper;

    @Override
    public List<ArchiveReceiveStatistics> selectArchiveReceiveStatisticsList(ArchiveReceiveStatistics archiveReceiveStatistics) {
        return archiveReceiveStatisticsMapper.selectArchiveReceiveStatisticsList(archiveReceiveStatistics);
    }

    @Override
    public ArchiveReceiveStatistics selectArchiveReceiveStatisticsById(Long id) {
        return archiveReceiveStatisticsMapper.selectArchiveReceiveStatisticsById(id);
    }

    @Override
    public int insertArchiveReceiveStatistics(ArchiveReceiveStatistics archiveReceiveStatistics) {
        return archiveReceiveStatisticsMapper.insertArchiveReceiveStatistics(archiveReceiveStatistics);
    }

    @Override
    public int updateArchiveReceiveStatistics(ArchiveReceiveStatistics archiveReceiveStatistics) {
        return archiveReceiveStatisticsMapper.updateArchiveReceiveStatistics(archiveReceiveStatistics);
    }

    @Override
    public int deleteArchiveReceiveStatisticsById(Long id) {
        return archiveReceiveStatisticsMapper.deleteArchiveReceiveStatisticsById(id);
    }

    @Override
    public int deleteArchiveReceiveStatisticsByIds(Long[] ids) {
        return archiveReceiveStatisticsMapper.deleteArchiveReceiveStatisticsByIds(ids);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int batchSaveArchiveReceiveStatistics(List<ArchiveReceiveStatistics> list) {
        // 先删除所有数据
        archiveReceiveStatisticsMapper.deleteAllArchiveReceiveStatistics();
        // 再批量插入新数据
        return archiveReceiveStatisticsMapper.batchInsertArchiveReceiveStatistics(list);
    }
}